package com.cskaoyan.main;

import com.cskaoyan.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 创建日期: 2022/06/30 09:52
 *
 * @author ciggar
 */
public class SecondDemo {


    public static void main(String[] args) throws SQLException {

        Connection connection = JDBCUtils.getConnection();



        Statement statement = connection.createStatement();


        ResultSet resultSet = statement.executeQuery("select * from student where id = 2000");

        while (resultSet.next()) {

            String name = resultSet.getString("name");
            System.out.println("name:" + name);
        }

//
//        Statement statement2 = connection.createStatement();
//
//
//        ResultSet resultSet2 = statement.executeQuery("select * from student where id = 2001");
//
//        while (resultSet2.next()) {
//
//            String name = resultSet2.getString("name");
//            System.out.println("name:" + name);
//        }




        JDBCUtils.releaseSources(connection,statement,resultSet);



    }
}
